<?php
/* @var $headTitle Zend_View_Helper_HeadTitle */
$headTitle = $this->getHelper('HeadTitle');

// kolejność renderowania widoku.. z actionStack jest wcześniej niż z akcji z której jest stack (?!)
count($this->urlParams('fromSite'))
	? $headTitle->prepend($this->row['name'])
	: $headTitle->append($this->row['name']);

/* @var $headMeta Zend_View_Helper_HeadMeta */
$headMeta = $this->getHelper('HeadMeta');

!strlen($this->row['meta_keywords']) or $headMeta->setName('keywords', $this->row['meta_keywords']);
!strlen($this->row['meta_description']) or $headMeta->setName('description', $this->row['meta_description']);

$time_create = strtotime($this->row['time_create']);

$content = $this->row['description'];
?>
<dl class="kx_gallery_album kx_display">
	<dt class="kx_time">
		<em class="kx_day"><?php print date('d', $time_create)?></em>
		<em class="kx_month"><?php print $this->translate(strtolower(date('F', $time_create)))?></em>
		<em class="kx_year"><?php print date('Y', $time_create)?></em>
	</dt>
	<dd class="kx_content">
		<div class="kx_head">
			<h1 class="kx_title"><?php print $this->row['name']?></h1>
		
			<?php if (count($site = $this->urlParams('fromSite'))):?>
				<a class="kx_back" href="<?php print $this->url(array('alias'=>$site['alias']),'site',true)?>">&laquo; powrót do strony <em><?php print $this->escape($site['name'])?></em></a>
			<?php else:?>
				<a class="kx_back" href="<?php print $this->url(array('action' => 'index','controller'=>'gallery','module'=>'gallery'),'default',true);?>">&laquo; powrót do spisu galerii</a>
			<?php endif;?>
		</div>
		
		<ul class="kx_gallery_images kx_list">
			<?php foreach ((array)$this->rowset as $row):?>
			
				<?php switch($row['type']):
						  default:?>
					<?php case 'image':?>
						<li class="kx_item kx_gallery_type_image">
							<a rel="libghtbox" href="/upload/gallery/preview/<?php print $this->escape($row['image'])?>">
					
							<?php if ('' != $row['name']):?>
								<em><?php print $row['name']?></em>
							<?php endif;?>
					
							<img alt="<?php print $row['name']?>" src="/upload/gallery/thumb/<?php print $this->escape($row['image'])?>"></a>
					
							<?php if ('' != $row['description']):?>
								<div class="kx_description"><?php print $this->getHelper('renderer')->render($content);?></div>
							<?php endif;?>
						</li>
					<?php break;?>
					
					<?php case 'media':?>
						<li class="kx_item kx_gallery_type_media">
							<a rel="libghtbox" href="<?php print $this->url(array('module'=>'gallery','controller' => 'media', 'action' => 'display', 'id' => $row['id']), 'default', true)?>">
							<?php if ('' != $row['name']):?>
								<em><?php print $row['name']?></em>
							<?php endif;?>
					
							<img alt="<?php print $row['name']?>" src="/upload/media/thumb/<?php print $this->escape($row['image'])?>"></a>
					
							<?php if ('' != $row['description']):?>
								<div class="kx_description"><?php print $this->getHelper('renderer')->render($content);?></div>
							<?php endif;?>
						</li>
					<?php break;?>
				
				<?php endswitch;?>
			
			<?php endforeach;?>
		</ul>
	</dd>
</dl>